package cn.gailvlun.gll.widget.photopicker;

import java.util.ArrayList;
import java.util.List;

import cn.gailvlun.gll.net.BuildConfig;
import cn.gailvlun.gll.util.IsEmpty;



public class PhotoItem {
    private String remoteUrl;
    private String ossKey;

    public String getRemoteUrl() {
        return remoteUrl;
    }

    private void setRemoteUrl(String remoteUrl) {
        this.remoteUrl = remoteUrl;
    }

    public String getOssKey() {
        return ossKey;
    }

    public void setOssKey(String ossKey) {
        this.ossKey = ossKey;
        this.remoteUrl = BuildConfig.OSS_IMG_DOMAIN + ossKey;
    }

    public static List<String> transform2oss(List<PhotoItem> list) {
        List<String> strings = new ArrayList<>();
        if (!IsEmpty.list(list)) {
            for (PhotoItem item :
                    list) {
                strings.add(item.getOssKey());
            }
        }
        return strings;
    }

    public static List<PhotoItem> transform2PhotoItem(List<String> list) {
        List<PhotoItem> photoItems = new ArrayList<>();
        if (!IsEmpty.list(list)) {
            for (String ossKey :
                    list) {
                PhotoItem item = new PhotoItem();
                item.setOssKey(ossKey);
                photoItems.add(item);


            }
        }
        return photoItems;
    }
}
